<div nz-row nzJustify="space-between">
  <div nz-col nzSpan=6>
    <h1>
      {{taskDetail.name}}
    </h1>
    <nz-tag *ngFor="let tag of taskTags">{{tag}}</nz-tag>
  </div>
  <div nz-col nzSpan="10" [ngSwitch]="taskDetail.processStatus">
    <nz-countdown *ngSwitchCase="2" [nzValue]="taskDetail.end?.getTime()" [nzTitle]="'剩余时间'"
      [nzFormat]="'D 天 H 时 m 分 s 秒'">
    </nz-countdown>
    <div class="task-process-status task-undone" *ngSwitchCase="0">未完成</div>
    <div class="task-process-status task-done" *ngSwitchCase="1">已完成</div>
  </div>
  <div nz-col nzSpan=4 class="title-operate">
    <button nz-button class="operation-button" nzType="primary" [disabled]="taskDetail.processStatus != 2" (click)="completeTask()">完成工作</button>
    <button nz-button class="operation-button" (click)="editTask()">编辑工作</button>
    <button nz-button class="operation-button" nzType="primary" nzDanger (click)="deleteTask()">删除工作</button>
  </div>
</div>


<div class="divider content">
  <span class="divider-text">结构</span>
</div>

<nz-tree [nzData]="treeView" nzShowExpand="false" nzShowLine nzExpandAll></nz-tree>

<div class="divider content">
  <span class="divider-text">详情</span>
  <span class="divider-button">
    <button nz-button nzType="link" (click)="editTask()">编辑</button>
  </span>
</div>
<div nz-row class="detail-line">
  <div nz-col nzSpan=5>
    <span class="detail-font detail-key">名称</span>
    <span class="detail-font">{{taskDetail.name}}</span>
  </div>
  <div nz-col nzSpan=5>
    <span class="detail-font detail-key">进行状态</span>
    <span class="detail-font">{{taskDetail.processStatus | processStatus}}</span>
  </div>
  <div nz-col nzSpan=5>
    <span class="detail-font detail-key">开始时间</span>
    <span class="detail-font">{{taskDetail.begin | date: 'yyyy-MM-dd HH:mm:ss'}}</span>
  </div>
  <div nz-col nzSpan=5>
    <span class="detail-font detail-key">结束时间</span>
    <span class="detail-font">{{taskDetail.end | date: 'yyyy-MM-dd HH:mm:ss'}}</span>
  </div>
  <div nz-col nzSpan=4>
    <span class="detail-font detail-key">等级</span>
    <span class="detail-font">{{taskDetail.importance | importance}}</span>
  </div>
</div>
<div class="detail-line">
  <span class="detail-font detail-key">工作目标</span>
  <span class="detail-font">{{taskDetail.target}}</span>
</div>
<div class="detail-line">
  <span class="detail-font detail-key">描述</span>
  <span class="detail-font">{{taskDetail.description}}</span>
</div>


<div class="divider content">
  <span class="divider-text">简 报</span>
  <span class="divider-button">
    <button nz-button nzType="link" (click)="addBiref()">添加简报</button>
  </span>
</div>

<nz-list nzItemLayout="vertical">
  <nz-list-item *ngFor="let brief of briefList">
    <nz-list-item-meta>
      <nz-list-item-meta-title>{{brief.subject}}</nz-list-item-meta-title>
      <nz-list-item-meta-description>{{brief.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-list-item-meta-description>
    </nz-list-item-meta>
    {{brief.brief}}
    <ul nz-list-item-actions>
      <nz-list-item-action>
        <a nz-button nzType="link" nzDanger nz-popconfirm nzPopconfirmTitle="删除这条简报?"
          (nzOnConfirm)="briefDeleteConfirm(brief.id)" (nzOnCancel)="briefDeleteCancel()" nzPopconfirmPlacement="top">
          <i nz-icon nzType="delete" nzTheme="outline"> </i> 删除
        </a>
      </nz-list-item-action>
      <nz-list-item-action>
        <a nz-button nzType="link" (click)="briefEditShow(brief)">
          <i nz-icon nzType="edit" nzTheme="outline"></i> 编辑
        </a>
      </nz-list-item-action>

    </ul>
  </nz-list-item>
  <nz-list-empty *ngIf="briefList.length === 0"></nz-list-empty>
</nz-list>


<nz-modal [(nzVisible)]="isTaskModalVisible" [nzTitle]="'编辑工作'" (nzOnCancel)="handleAdderCancel()"
  (nzOnOk)="handleAdderOk()" [nzClosable]="false" [nzMaskClosable]="false">
  <app-phase-task-adder #taskAdder [taskSelectNode]="taskSelectNode"></app-phase-task-adder>
</nz-modal>

<nz-modal [(nzVisible)]="isTaskBriefVisible" [nzTitle]="briefModalTitle" (nzOnCancel)="handleBriefCancel()"
  (nzOnOk)="handleBriefOk()" [nzClosable]="false" [nzMaskClosable]="false">
  <app-brief-adder #briefAdder></app-brief-adder>
</nz-modal>
